package com.example.leetcode.niuke;

import java.util.Scanner;

public class NiuKe12 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i = Integer.parseInt(scanner.nextLine());
        String s = scanner.nextLine();
        int i1 = Integer.parseInt(scanner.nextLine());
        String[] split = s.split(" ");
        int r = 0;
        if (i <= i1) {
            for (int j =0 ; j<i;i++) {
                r+= Integer.parseInt(split[j]);
            }
        }else {
            for (int j = 0;j < i1;j++) {
                r+= Integer.parseInt(split[j]);
            }
            int t = r;
            int right = i1;
            int left = 0;
            while (right < i) {
                t -= Integer.parseInt(split[left]);
                t += Integer.parseInt(split[right]);
                r = Math.max(r,t);
                right++;
                left++;
            }
        }
        System.out.println(r);
    }
}
